using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Yoozoo.UI;
public class RectTransformBinderTreeItem : BindingBinderTreeItemBase
{
    public static Dictionary<RectTransformBinder.AttributeType, LinkerValueState> AttributeValueDic = new Dictionary<RectTransformBinder.AttributeType, LinkerValueState>
    {
        {RectTransformBinder.AttributeType.anchorMin, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.anchorMax, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.anchoredPosition, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.sizeDelta, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.pivot, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.anchoredPosition3D, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.offsetMin, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.offsetMax, LinkerValueState.Vector2},
        {RectTransformBinder.AttributeType.position, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.localPosition, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.eulerAngles, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.localEulerAngles, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.right, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.up, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.forward, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.rotation, LinkerValueState.Quaternion},
        {RectTransformBinder.AttributeType.localRotation, LinkerValueState.Quaternion},
        {RectTransformBinder.AttributeType.localScale, LinkerValueState.Vector3},
        {RectTransformBinder.AttributeType.hasChanged, LinkerValueState.Boolean},
        {RectTransformBinder.AttributeType.hierarchyCapacity, LinkerValueState.Int32},
    };
    public RectTransformBinderTreeItem() : base(typeof(RectTransformBinder))
    {
    }
    
    public override void RebuildTree()
    {
        base.RebuildTree();
        foreach (RectTransformBinder.AttributeType binderType in Enum.GetValues(typeof(RectTransformBinder.AttributeType)))
        {
            BindingLinkerTreeItem linkerTreeItem = new BindingLinkerTreeItem(binderType.ToString(), binderType.ToString(), (int)AttributeValueDic[binderType]);
            AddChild(linkerTreeItem);
        }
    }
}